package com.qf.java2201.web;

import com.qf.java2201.dao.UserinfoDao;
import com.qf.java2201.dao.impl.UserinfoDaoImpl;
import com.qf.java2201.pojo.HUserinfo;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/showDoctor")
public class ShowDoctorServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String tid = req.getParameter("tid");

        UserinfoDao userinfoDao = new UserinfoDaoImpl();

        List<HUserinfo> uis =userinfoDao.findUserinfoByKsid(tid);

        HttpSession session = req.getSession();
        session.setAttribute("uis", uis);
        resp.sendRedirect("sd.jsp");
    }
}
